import sys

QX = input("是否开始（YES/NO）:")

state = '0'

while state == '0':
    if QX == "YES":
        while True:
            try:
                #m = input('').split(' ')
                #xinbie,weight,height,age = m[0],m[1]
                xinbie = input("输入性别")
                input_str = input("输入身高(cM) 输入体重(KG) 输入年龄(age) ")
                list = input_str.split(' ')
                height = int(list[0])
                weight = int(list[1])
                age = int(list[2])
                #str_list = input_str.strip(',')
                #weight = int(input("体重"))
                #height = int(input("身高"))
                #age = int(input("年龄"))


                if xinbie == "男":
                    bmr = 10*weight + 6.25*height - 5*age + 5
                    print("基础代谢率：", bmr)
                    break
                if xinbie == "女":
                    bmr = 10 * weight + 6.25 * height - 5 * age - 161
                    print("基础代谢率(大卡)：", bmr)
                    break

            except ValueError:
                print("出错")

    elif QX =="NO":
        sys.exit()
    else:
        print("无效")
        sys.exit()

    state = str(input('是否继续：0-继续 任意键结束'))